const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { sources } = require('webpack')

module.exports = {
  mode: 'development',
  entry: './src/index.js',
  devtool: 'source-map', // 添加这一行以启用 Source Map
  output: {
    filename: 'bundle.js',
    path: __dirname + '/dist',
    library: 'MiniVue' // 暴露一个全局变量
  },
  devServer: {
      hot: true,
      port: 3000
  },
  resolve: { // 解析规则
    extensions: ['.js'] // 在js文件中引用其他js文件可以不用写后缀名
},
  plugins: [
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, 'public/index.html')
    })
  ]
}